
/**************************************************************************
 *         Copyright(c) 2007 by Sunplus mMedia  Technology Co., Ltd.       *
 *                                                                         *
 *  This software is copyrighted by and is the property of Sunplus mMedia  *
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Techno- *
 *  logy Co., Ltd. This software may only be used in accordance with the   *
 *  corresponding license agreement. Any unauthorized use, duplication,    *
 *  distribution, or disclosure of this software is expressly forbidden.   *
 *                                                                         *
 *  This Copyright notice "M U S T" not be removed or modified without     *
 *  prior written consent of Sunplus mMedia Technology  Co., Ltd.          *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this  *
 *  software without notice.                                               *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd.                                    *
 *  19-1, Innovation First Road, Science-Based Industrial Park,            *
 *  Hsin-Chu, Taiwan, R.O.C.                                               *
 *                                                                         *
 **************************************************************************/
#ifndef __PIMAFILE_H__
#define __PIMAFILE_H__

//------------------------------------------------------------------------------
//Constant
//------------------------------------------------------------------------------

//Storage ID
#define K_PIMADATA_IDStorage			0x05050505

#define K_PIMADATA_StorageIDsSize		0x00000001
typedef struct _PIMADATA_STORAGE_ID
{
	UINT32   storageIDsSize;
	UINT32   storageIDs[K_PIMADATA_StorageIDsSize];
} PIMADATA_STORAGE_ID, *PPIMADATA_STORAGE_ID;


//Storage Info
#define K_PIMADATA_MaxCapacitySize		0x08
#define K_PIMADATA_FreeSpaceInByteSize		0x08
typedef struct _PIMADATA_STORAGE_INFO
{
        UINT16  storageType;
        UINT16  filesystemType;
        UINT16  accessCapability;
        UINT8   maxCapacity[K_PIMADATA_MaxCapacitySize];
        UINT8   freeSpaceInByte[K_PIMADATA_FreeSpaceInByteSize];
	UINT32   freeSpaceInImage;
        //STR0x00 storageDescription;
        //STR0x00 volumnLabel;
        UINT8   storageDescription;
        UINT8   volumnLabel;
} PIMADATA_STORAGE_INFO, *PPIMADATA_STORAGE_INFO;

#define K_PIMADATA_StorageType_Undefined	0x0000
#define K_PIMADATA_StorageType_FixedRom		0x0100
#define K_PIMADATA_StorageType_RemovableRom	0x0200
#define K_PIMADATA_StorageType_FixedRam		0x0300
#define K_PIMADATA_StorageType_RemovableRam	0x0400

#define K_PIMADATA_FilesystemType_Undefined	0x0000
#define K_PIMADATA_FilesystemType_GenericFlat	0x0100
#define K_PIMADATA_FilesystemType_GenericHier	0x0200
#define K_PIMADATA_FilesystemType_DCF		0x0300

#define K_PIMADATA_AccessCapability_ReadWrite			0x0000
#define K_PIMADATA_AccessCapability_ReadOnlyWithoutDelete	0x0100
#define K_PIMADATA_AccessCapability_ReadOnlyWitDelete		0x0200

#define K_PIMADATA_StorageDescriptionSize	0x00            //size of storage desc 
#define K_PIMADATA_VolumnLabelSize		0x00            //size of volumn label 

//Object Info
#define K_PIMADATA_OBJINF_LEN (78+4)
#define K_PIMADATA_ObjectInfoFileNameBufSize	0x1A0
typedef struct _PIMADATA_OBJECT_INFO
{
        UINT32	storageID;
        UINT16  objectFormat;
        UINT16	protectionStatus;
        UINT32	objectCompressedSize;
        UINT16	thumbFormat;
	UINT32	thumbCompressedSize;
	UINT32	thumbPixWidth;
	UINT32	thumbPixHeight;
	UINT32	imagePixWidth;
	UINT32	imagePixHeight;
	UINT32	imageBitDepth;
	UINT32	parentObject;
	UINT16	associationType;
	UINT32	associationDesc;
	UINT32	sequenceNumber;
	UINT8	fileNameBuf[K_PIMADATA_ObjectInfoFileNameBufSize];
}PIMADATA_OBJECT_INFO, *PPIMADATA_OBJECT_INFO;

//------------------------------------------------------------------------------
//External Link
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//Function Prototype
//------------------------------------------------------------------------------
UINT8 PIMAFILE_GetStorageIDs(UINT32* pSize, UINT8* pPayload);
UINT8 PIMAFILE_GetStorageInfo(UINT32 storageID, UINT32* pSize, UINT8* pPayload);
UINT8 PIMAFILE_GetNumObjects(UINT32 storageID, UINT32 objFormatCode, UINT32 objHandle, UINT32* pNumObjects);
//richie@si1227
UINT8 PIMAFILE_GetObjectHandles(UINT32 storageID, UINT32 objFormatCode, UINT32 objHandle, UINT32* pSize, UINT8* pPayload);
UINT8 PIMAFILE_GetObject(UINT32 objHandle, UINT32* pSize);
UINT8 PIMAFILE_GetThumb(UINT32 objHandle, UINT32* pSize);
UINT8 PIMAFILE_DeleteObject(UINT32 objHandle, UINT32 objFormatCode);
UINT8 PIMAFILE_GetPartialObject(UINT32 objHandle, UINT32 offsetInBytes, UINT32 maxBytesObtained, UINT32* pSize);

#endif /*__PIMAFILE_H__*/
